/**
 * Copyright 2007-2008. Chongqing First Information & Network Co., Ltd. All
 * rights reserved. <a>http://www.cqfirst.com.cn</a>
 */
package com.cqcis.uip.base.filelog.log.dao;

import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;

import com.cqcis.uip.base.framework.common.InterfaceLog;
import com.cqcis.uip.base.framework.utils.JdbcUtil;


/**
 * @author huangmy
 * @date   2007-12-21
 */
public class InterfaceLogDao extends SimpleJdbcDaoSupport{
	// 保存
    private final static String insertSql = 
    	  "insert into tin_log(record_id, interface_id, send_time, recv_time, send_record, recv_record) " 
    	+ "values(:recordId,:interfaceId,:sendTime,:recvTime,:sendRecord,:recvRecord)";
    
    private final static String getCurrentTimeSql = "select first 1 CURRENT YEAR TO SECOND from systables";
    
    /**
     * 保存
     * 
     * @param log
     */
    public void insert(final InterfaceLog log) {
    	if (log.isSaved()) {
    		return;
    	}
    	JdbcUtil.update(insertSql, log, this);
    	log.setSaved(true);
    }
    
    /**
     * 当前时间
     * 
     * @return
     */
    public String getCurrentTime() {
    	return (String)JdbcUtil.queryForObject(this, String.class, getCurrentTimeSql);
    }    
}
